home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cpp.arc / CPP.MAN < prev    next >
Encoding:
Text File  |  1986-12-04  |  5.3 KB  |  199 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.     NAME
  7.         cpp - C Pre-Processor
  8.  
  9.     SYNOPSIS
  10.         cpp [-options] [infile [outfile]]
  11.  
  12.     DESCRIPTION
  13.         Cpp  reads  a C source file, expands macros and include files,
  14.     and writes an  input  file  for  the  C  compiler.    If  no  file
  15.     arguments  are  given,  cpp reads from stdin and writes to stdout.
  16.     If one file argument is given, it  will  define  the  input  file,
  17.     while two file arguments define both input and output files.
  18.  
  19.     The following  options  are  supported.    Options may be given in
  20.     either case.
  21.  
  22.     -I directory
  23.         Add this directory to the list  of  directories  searched  for
  24.     #include "..."  and  #include  <...> commands.  Note that there is
  25.     no space between the -I and the directory string.  More  than  one
  26.     -I command  is permitted.  On non-Unix systems directory is forced
  27.     to upper-case.
  28.  
  29.     -D name=value
  30.         Define the name as if the programmer wrote
  31.  
  32.                     #define name value
  33.  
  34.     at the start of the first file.  If =value is not given,  a  value
  35.     of "1" will be used.
  36.  
  37.     On  non-unix  systems,  all  alphabetic  text  will  be  forced to
  38.     upper-case.
  39.  
  40.     -U name
  41.         Undefine the name as if
  42.  
  43.                     #undef name
  44.  
  45.     were given.    On  non-Unix  systems,  name  will  be  forced   to
  46.     upper-case.
  47.  
  48.     The following variables are pre-defined:
  49.  
  50.     Target computer (as appropriate):
  51.  
  52.             pdp11, vax, M68000 m68000 m68k
  53.  
  54.     Target operating system (as appropriate):
  55.  
  56.             rsx, rt11, vms, unix
  57.  
  58.     Target compiler (as appropriate):
  59.  
  60.             decus, vax11c
  61.  
  62.     The implementor  may  add  definitions  to this list.  The default
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.     definitions match the definition of the host  computer,  operating
  72.     system, and C compiler.
  73.  
  74.     The following are always available unless undefined:
  75.  
  76.     __FILE__
  77.         The  input  (or  #include)  file  being  compiled (as a quoted
  78.     string).
  79.  
  80.     __LINE__
  81.         The line number being compiled.
  82.  
  83.     __DATE__
  84.         The date and time  of  compilation  as  a  Unix  ctime  quoted
  85.     string (the trailing newline is removed).  Thus,
  86.  
  87.        printf("Bug at line %s,", __LINE__);
  88.        printf(" source file %s", __FILE__);
  89.        printf(" compiled on %s", __DATE__);
  90.  
  91.     -X number
  92.         Enable debugging  code.    If  no value is given, a value of 1
  93.     will be used.  (For maintenence of CPP only.)
  94.  
  95.     DRAFT ANSI STANDARD CONSIDERATIONS:
  96.         Comments are removed from the input  text.    The  comment  is
  97.     replaced by  a single space character.  This differs from usage on
  98.     some existing preprocessors (but  it  follows  the  Draft  Ansi  C
  99.     Standard).
  100.  
  101.     Note that arguments may be concatenated as follows:
  102.  
  103.         #define I(x)x
  104.         #define CAT(x,y)I(x)y
  105.         int value = CAT(1,2);
  106.  
  107.     If  the  above  macros  are defined and invoked without extraneous
  108.     spaces, they  will  be  transportable  to  other  implementations.
  109.     Unfortunately, this will not properly expand
  110.  
  111.         int CAT(foo,__LINE__);
  112.         int CAT(foo,__LINE__);
  113.  
  114.     as   __LINE__   is   copied   into   the  input  stream,  yielding
  115.     "foo__LINE__" in both cases, rather than  the  expected  "foo123",
  116.     "foo124",  which  would  result  if __LINE__ were expanded and the
  117.     result copied into the input stream.
  118.  
  119.     Macro formal parameters are not recognized within  quoted  strings
  120.     and character constants in macro definitions.
  121.  
  122.     CPP implements  most  of  the  ANSI draft standard.  You should be
  123.     aware of the following differences:
  124.  
  125.         In the draft standard, the  \n  (backslash-newline)  character
  126.     is "invisible"  to  all processing.  In this implementation, it is
  127.     invisible   to   strings,   but    acts    as    a    "whitespace"
  128.     (token-delimiter) outside   of   strings.      This   considerably
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.     simplifies error message handling.
  138.  
  139.         The following new features of C are processed by cpp:
  140.             #elif expression     (#else #if)
  141.             '\xNNN'              (Hexadecimal constants)
  142.             '\a'                 (Ascii BELL [silly])
  143.             '\v'                 (Ascii VT)
  144.             #if defined NAME     (1 if defined, 0 if not)
  145.             #if defined (NAME)   (1 if defined, 0 if not)
  146.             unary + (gag me with a spoon)
  147.  
  148.         The  draft  standard  has  extended   C,   adding   a   string
  149.     concatenation operator, where
  150.  
  151.             "foo" "bar"
  152.  
  153.     is regarded  as the single string "foobar".  (This does not affect
  154.     CPP's processing.)
  155.  
  156.     ERROR MESSAGES:
  157.         Many.
  158.  
  159.     CPP prints warning  messages  if  you  try  to  use  multiple-byte
  160.     character  constants (non-transportable) or if you #undef a symbol
  161.     that was not defined.
  162.  
  163.     BUGS:
  164.         Cpp  prints  spurious  error  or  warning  messages   in   #if
  165.     sequences such as the following:
  166.  
  167.         #define foo 0
  168.         #if (foo != 0) ?  (100 / foo) :  0
  169.         #undef foo
  170.         #if ((defined(foo)) ?  foo :  0) == 1
  171.  
  172.     Cpp  should supress the error message if the expression's value is
  173.     already known.
  174.  
  175.     This document is not necessarily up-to-date.    The  file  cpp.rno
  176.     (cpp.mem) contains correct source for the documentation.
  177.  
  178.     AUTHOR:
  179.         Martin Minow
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.